using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using XNALibrary.Game;

namespace XNALibrary.PostProcessing
{
    public class OldMovieFilter : BaseFilter
    {
        private Texture2D noise;
        private Texture2D Splotches;
        private Texture2D Sepia;
        private EffectParameter timer;

        //Constructor
        public OldMovieFilter(int texture)
            : base(texture)
        {
        }

        public override void Register()
        {
            Shader = BaseGame.content.Load<Effect>("Resources\\Effects\\PostProcessing\\OldMovie");
            noise = BaseGame.content.Load<Texture2D>("Resources\\Textures\\1D_Noise");
            Splotches = BaseGame.content.Load<Texture2D>("Resources\\Textures\\8x8PagesSplotches2");
            Sepia = BaseGame.content.Load<Texture2D>("Resources\\Textures\\Sepia1D");

            Shader.Parameters["noise"].SetValue(noise);
            Shader.Parameters["Splotches"].SetValue(Splotches);
            Shader.Parameters["Sepia"].SetValue(Sepia);
            timer = Shader.Parameters["time_cycle_period"];
        }

        public override void Update()
        {
            timer.SetValue((float)BaseGame.gameTime.TotalGameTime.TotalSeconds * 20);
        }

    }
}
